package com.hfy.music.controller;

import com.hfy.model.dto.AlbumDto;
import com.hfy.music.service.AlbumService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import result.Result;

/**
 * @ author 韩
 * time: 2024/7/17 14:50
 */

@RestController
@RequestMapping("/album")
@Tag(name = "对专辑操作的接口类" ,description = "主要就是对专辑进行crud的这一系列操作")
public class AlbumController {
    @Autowired
    private AlbumService albumService;


    @PostMapping("/add")
    @Operation(summary = "添加一个新的专辑")
    @Parameters({@Parameter(name = "name", description = "专辑名称"),
            @Parameter(name = "cover", description = "专辑封面的url"),
            @Parameter(name = "account", description = "音乐人账号"),
            @Parameter(name = "style", description = "流派"),
            @Parameter(name = "des", description = "简介")
    })
    public Result addAlbum(@RequestBody AlbumDto dto) {
        return albumService.addAlbum(dto);
    }

    @GetMapping("/getAlbums")
    @Operation(summary = "获取音乐人的专辑列表")
    @Parameters({@Parameter(name = "account", description = "音乐人账号")
    })
    public Result getAlbums(@RequestParam("account") Long account) {
        return albumService.getAlbums(account);
    }


    @GetMapping("/styles/list")
    @Operation(summary = "列出所有专辑风格")
    @Parameters({})
    public Result listAlbumStyles() {
        return albumService.listAlbumStyles();
    }
}
